{if $account_activated}
	<p class="message">
		[[Your account was successfully activated. Thank you.]]
	</p>
{/if}
{title}[[Post {$listingTypeID|htmlentities}]]{/title}
{if $nextPage || $prevPage}
<div class="bread-crumb">
{foreach from=$pages item=page name=page_block}
	<div class="input-form-bc">{if $page.sid == $pageSID}<b>&gt;&nbsp;[[{$page.page_name}]]</b>{else}{if $page.order <= $currentPage.order}<a href="{$GLOBALS.site_url}/add-listing/{$listingTypeID|htmlentities}/{$page.page_id}/{$listingSID}">&gt;&nbsp;[[{$page.page_name}]]</a>{else}&gt;&nbsp;[[{$page.page_name}]]{/if}{/if}{if !$smarty.foreach.page_block.last}{/if}&nbsp;</div>
{/foreach}
</div>
{/if}
<div class="clr"></div>
<h1>[[{$currentPage.page_name}]]</h1>
<div>[[{$currentPage.description}]]</div>
{* SOCIAL PLUGIN: AUTOFILL *}
{if $socialAutoFillData.allow}
<div id="social_autoFill" class="{$socialAutoFillData.network}_16">
	{if $socialAutoFillData.logged}
	{if $currentPage && $listing_sid}
	<a href="{$GLOBALS.site_url}/add-listing/{$listingTypeID|htmlentities}/{$currentPage.page_id}/{$listing_sid}/?autofill" title="">[[Auto-fill resume from my {$socialAutoFillData.network} profile]]</a>
	{else}
	<a href="{$GLOBALS.site_url}/add-listing/?listing_type_id={$listingTypeID|htmlentities}&amp;product_sid={$product_sid}&amp;autofill" title="">[[Auto-fill resume from my {$socialAutoFillData.network} profile]]</a>
	{/if}
	{else}
	<a href="{$GLOBALS.site_url}/social/?network={$socialAutoFillData.network}">[[Login with Linkedin to Auto-fill resume from my {$socialAutoFillData.network} profile]]</a>
	{/if}
</div>
{/if}
{* END / SOCIAL PLUGIN: AUTOFILL *}
{include file='field_errors.tpl'}
<form method="post" action="{$GLOBALS.site_url}/add-listing/{$listingTypeID|htmlentities}/{$currentPage.page_id}/{$listingSID}" enctype="multipart/form-data" {if $form_fields.ApplicationSettings}onsubmit="return validateForm('addListingForm');"{/if} id="addListingForm" class="inputForm">
<input type="hidden" name="product_sid" value="{$product_sid}" />

<input type="hidden" name="listing_type_id" value="{$listingTypeID|htmlentities}" />
<input type="hidden" id="listing_id" name="listing_id" value="{$listing_id}" />
<p class="marked-fields">[[Fields marked with an asterisk (]]<font color="red">*</font>[[) are mandatory]]</p>
{set_token_field}

{include file="input_form_default.tpl"}

{if $pic_limit > 0 && !$prevPage && !$listing_sid}
	<fieldset>
		<div class="inputName"> [[Add Pictures]] </div>
		<div class="inputReq">&nbsp;</div>
		<div class="inputField" style="width:70%">
			<div id="loading" style="display:none;">
				<img class="progBarImg" src="{$GLOBALS.site_url}/system/ext/jquery/progbar.gif" alt="[[Please wait ...]]" /> [[Please wait ...]]
			</div>
			<div id="UploadPics" value="{$GLOBALS.site_url}/manage-pictures/?product_sid={$product_sid}&amp;listing_sid={$listing_id}"></div>
			<br /><br />
		</div>
	</fieldset>
{elseif  $pic_limit > 0 && !$prevPage && $listing_sid}
	<fieldset>
		<div class="inputName"> [[Add Pictures]] </div>
		<div class="inputReq">&nbsp;</div>
		<div class="inputField" style="width:70%">
			<div id="loading" style="display:none;">
				<img class="progBarImg" src="{$GLOBALS.site_url}/system/ext/jquery/progbar.gif" alt="[[Please wait ...]]" /> [[Please wait ...]]
			</div>
			<div id="UploadPics" value="{$GLOBALS.site_url}/manage-pictures/?listing_sid={$listing_sid}"></div>
			<br /><br />
		</div>
	</fieldset>
{/if}

<fieldset>
	<div class="inputName">&nbsp;</div>
	<div class="inputReq">&nbsp;</div>
	<div class="inputField">
		{if $prevPage}
		    <input type="button" name="action_add" value="[[Back]]" class="button" onclick="window.location = '{$GLOBALS.site_url}/add-listing/{$listingTypeID|htmlentities}/{$prevPage}/{$listingSID}'" />&nbsp;&nbsp;&nbsp;
		{/if}
		{if $nextPage}
		    <input type="submit" name="action_add" value="[[Next]]" class="button" />
		{else}
            <input type="submit" name="preview_listing" value="[[Preview]]" class="button" id="listingPreview"/>
            <input type="submit" name="action_add" value="[[Post]]" class="button" />
		{/if}
	</div>
</fieldset>
</form>

{literal}
<script type="text/javascript">
	$(document).ready(function() {
		url = $("#UploadPics").attr("value");
        if (url != undefined) {
            $.ajax({
                url: url,
                beforeSend: function() {
                    $("#loading").show();
                    $("#UploadPics").hide();
                },
                success: function(data){
                    $("#loading").hide();
                    $("#UploadPics").html(data);
                    $("#UploadPics").show();
            }});
        }
    });

function deletePicture(listingId, pictureId) {
	if (confirm('Are you sure?') ) {
		var options = {
			target: "#UploadPics",
			url: '{/literal}{$GLOBALS.site_url}{literal}/manage-pictures/?listing_sid=' + listingId + '&action=delete&picture_id=' + pictureId,
			beforeSend: function(data) {
				$("#UploadPics").css({"opacity" : "0.3"});
				$("#loading").show();
			},
			success: function(data) {
				$("#UploadPics").css({"opacity" : "1"});
				$("#loading").hide();
			}
		};
		$("#messageBox").ajaxSubmit(options);
	}
};

function editPicture(listingId, pictureId) {
	{/literal}popUpWindow('{$GLOBALS.site_url}/classifieds/edit-picture/?listing_id=' + listingId + '&picture_id=' + pictureId, 560, 400, '[[Edit Picture]]');{literal}
}

</script>
{/literal}